package com.springboot.rabbitmq.hello;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: lzx
 * @Data: 2021/04/29/11:44
 * @Description：
 */
@Component          //持久化  非独占  不是自动删除队列
//@RabbitListener(queuesToDeclare = @Queue(value="hello",durable = "true",autoDelete = "true"))//消费者监听，接收哪个队列
@RabbitListener(queuesToDeclare = @Queue("hello"))
public class HelloCustomer {
    //方法名随便
    //回调方法
    @RabbitHandler
    public void test(String message ) {
        System.out.println("message:" + message);
    }
}
